// pages/book/book.js
import { BookModel } from '../../models/BookModel'
import { random } from '../../utils/common'
const bookModel = new BookModel()
Page({

    /**
   * 页面的初始数据
   */
    data: {
        books: [],
        searching: false

    },

    /**
   * 生命周期函数--监听页面加载
   */
    onLoad: function (options) {
        bookModel.getHotList().then(res => {
            this.setData({
                books: res.data
            })
        })
    },
    onSearching: function (event) {
        this.setData({
            searching: true
        })
    },
    onCancel () {
        this.setData({
            searching: false
        })
    },
    onReachBottom () {
        this.setData({
            more: random(16)
        })
    }
})
